# Seed for random number generation
set.seed(42)
knitr::opts_chunk$set(cache.extra = knitr::rand_seed)
I will gather data from 40 rules issued by financial agencies, including but not limited to the Consumer Financial Protection Bureau, the Treasury Department, and the Office of the Comptroller of the Currency. I focus on public comments issued by members of Congress and focus on whether their demands were ultimately fulfilled in the final rule. The research design additionally combines data from a previous study conducted by Jennifer L. Selin, who determined an estimate of the level of structural independence for several agencies during the Obama administration. My study will also include rules during the subsequent Trump administration, wherein the Senate majority switched to the Republican party. I will compare and contrast rules from both eras to determine if influence from political parties have grown over time, including determining if there is an increased presence of politicians commenting on policies. I will also use textual analysis in addition to the hand coding to see if elected officials use more partisan rhetoric over time. In this study, “partisan rhetoric” refers to an individual making positive assertions about their own party or negative assertions about the opposing party. I will also examine whether the demands of elected officials that are the same party as the President are increasingly met over those of the opposing party.
We used R [Version 4.1.2; R Core Team (2021)] and the R-packages data.table [Version 1.14.2; Dowle and Srinivasan (2021)], dplyr [Version 1.0.7; Wickham et al. (2021)], googlesheets4 [Version 1.0.0; Bryan (2021)], gsheet [Version 0.4.5; Conway (2020)], papaja [Version 0.1.0.9997; Aust and Barth (2020)], readxl [Version 1.3.1; Wickham and Bryan (2019)], and stringr [Version 1.4.0; Wickham (2019)] for all our analyses.
library(gsheet)
gsheet2tbl('https://docs.google.com/spreadsheets/d/1HBjG32qWVdf9YxfGPEJhNmSw65Z9XzPhHdDbLnc3mYc/edit?usp=sharing')
## No encoding supplied: defaulting to UTF-8.
#install.packages("googlesheets4")
library(googlesheets4)
congress_data <- read_sheet("https://docs.google.com/spreadsheets/d/1HBjG32qWVdf9YxfGPEJhNmSw65Z9XzPhHdDbLnc3mYc/edit?usp=sharing")
## ! Using an auto-discovered, cached token.
## To suppress this message, modify your code or options to clearly consent to
## the use of a cached token.
## See gargle's "Non-interactive auth" vignette for more details:
## <https://gargle.r-lib.org/articles/non-interactive-auth.html>
## ℹ The googlesheets4 package is using a cached token for 'bhushan3@wisc.edu'.
## ✓ Reading from "comments_congress".
## ✓ Range 'comments_congress_clean'.
## Warning in .Primitive("as.double")(x, ...): NAs introduced by coercion
## New names:
## * `` -> ...40
#finding financial rules
#congress_data[!(is.na(congress_data$success) | congress_data$success==""), ]
# select variables v1, v2, v3
myvars <- c("docket_id","submitter_name", "position", "success")
newdata <- congress_data[myvars]
#removing rows with no success coded
clean_congress <- newdata[!(is.na(newdata$success) | newdata$success==""), ]
clean_congress
#creating new dataset with financial agencies and estimates
library(stringr)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
financial_rules <- c("CFPB", "OCC", "IRS", "TREAS", "FTC")
cfpbSubset <- clean_congress[grep("CFPB", clean_congress$docket_id), ]
occSubset <- clean_congress[grep("OCC", clean_congress$docket_id), ]
irsSubset <- clean_congress[grep("IRS", clean_congress$docket_id), ]
treasSubset <- clean_congress[grep("TREAS", clean_congress$docket_id), ]
ftcSubset <- clean_congress[grep("FTC", clean_congress$docket_id), ]
congresult <- filter(clean_congress, grepl(paste(financial_rules, collapse="|"), docket_id))
congresult
avg_success <- c(mean(cfpbSubset$success), mean(occSubset$success), mean(irsSubset$success), mean(treasSubset$success), mean(ftcSubset$success))
avg_success
## [1] -0.7903226 -1.7647059 -2.0000000 0.0000000 NaN
library(readxl)
federal_agencies <- read_excel("/Users/samihabhushan/Documents/financial/federal_agencies_estimate.xlsx")
federal_agencies_estimate <- c(federal_agencies$Estimate)
federal_agencies_estimate
## [1] 4.100 1.643 0.174 0.218 2.269
# merge two data frames by ID
fed_id <- merge(avg_success,federal_agencies)
federal_agencies_table <- read_excel("/Users/samihabhushan/Documents/financial/federal_agencies_merged.xlsx")
summary(federal_agencies_table)
## Agency Estimate Avg_Success
## Length:5 Min. :0.174 Min. :-2.0000
## Class :character 1st Qu.:0.218 1st Qu.:-1.7647
## Mode :character Median :1.643 Median :-0.8947
## Mean :1.681 Mean :-1.0463
## 3rd Qu.:2.269 3rd Qu.:-0.3480
## Max. :4.100 Max. :-0.2240
cor(federal_agencies_table$Estimate, federal_agencies_table$Avg_Success)
## [1] 0.1972971
plot(Estimate ~ Avg_Success, data=federal_agencies_table)
fed_estim.lm <- lm(Estimate ~ Avg_Success, data=federal_agencies_table)
regression_fed <- summary(fed_estim.lm)
Running a multiple regression analysis on the overall average success and independence estimates, the correlation between the level of independence of federal agencies and average success overall for combined rules, the correlation coefficient is ‘r cor(federal_agencies_table\(Estimate, federal_agencies_table\)Avg_Success)’ and the r-squared value is 0.0043, suggesting that the 0.43% of variation in success is explained by agency’s level of independence.
#formatting merged datasets
knitr::kable(head(federal_agencies_table), "pipe")
| Agency | Estimate | Avg_Success |
|---|---|---|
| CFPB | 4.100 | -0.8947368 |
| OCC | 1.643 | -1.7647059 |
| IRS | 0.174 | -2.0000000 |
| TREAS | 0.218 | -0.2240000 |
| FTC | 2.269 | -0.3480000 |
plot(federal_agencies_table)
regression_fed <- summary(fed_estim.lm)
apa_table(
federal_agencies_table
, caption = "Descriptive statistics of federal independence by agencies."
, note = "avg success vs agencies"
)
| Agency | Estimate | Avg_Success |
|---|---|---|
| CFPB | 4.10 | -0.89 |
| OCC | 1.64 | -1.76 |
| IRS | 0.17 | -2.00 |
| TREAS | 0.22 | -0.22 |
| FTC | 2.27 | -0.35 |
Note. avg success vs agencies